package firstStage.part7;

/**
 * @ClassName: [Student1]
 * @Description: 学生类
 * @Author: [黄劲松]
 * @CreateDate: [2021-02-06]
 * @Version: [v1.0]
 */
public class Student1 {
    //成员变量
    String name;
    private int age;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age < 0 || age > 120) {
            System.out.println("年龄有误");
        } else {
            this.age = age;
        }
    }

    //成员方法
    public void show() {
        System.out.println(name + "," + age);
    }
}
